<?php
class LogController extends \Slim\Middleware{
    	
    public function call(){
    	//The Slim application
    	$app = $this->app;
		$ruta = $this->app->request()->getResourceUri();
		if (strpos($ruta,'/services/') === false && strpos($ruta,'/nroOrdenConsulta/') === false
		&& strpos($ruta,'/encuesta/') === false) {
			if(!isset($_SESSION['user']) && !isset($_POST['user'])){
					
				$app->render('../web/pages/commons/login.php');
			}else{
				$this->next->call();
			}
		}else{
			if (strpos($ruta,'/nroOrdenConsulta/') !== false || strpos($ruta,'/encuesta/') !== false){
				$_SESSION['tipoUsuario'] = "cliente";
			}
			$this->next->call();
		}
    }
}